<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%user}}".
 *
 * @property integer $id
 * @property string $name
 * @property string $password
 * @property integer $status
 * @property string $contact_name
 * @property string $mobile
 * @property string $phone
 * @property string $fax
 * @property string $qq
 * @property string $email
 * @property integer $is_root
 * @property integer $user_type
 * @property string $adnetwork_slot
 * @property string $traffic_slot
 * @property string $media_slot
 * @property string $registed_at
 * @property string $registed_ip
 * @property string $lastlogin_at
 * @property string $lastlogin_ip
 * @property integer $login_count
 * @property integer $creator
 * @property string $last_update
 */
class User extends \app\models\BaseAR
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%user}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'password', 'status'], 'required'],
            [['status', 'is_root', 'user_type', 'login_count', 'creator'], 'integer'],
            [['last_update'], 'safe'],
            [['name', 'contact_name', 'email'], 'string', 'max' => 64],
            [['password'], 'string', 'max' => 50],
            [['mobile', 'phone', 'fax'], 'string', 'max' => 32],
            [['qq'], 'string', 'max' => 16],
            [['adnetwork_slot', 'traffic_slot', 'media_slot'], 'string', 'max' => 128],
            [['registed_at', 'lastlogin_at'], 'string', 'max' => 19],
            [['registed_ip', 'lastlogin_ip'], 'string', 'max' => 15],
            [['name'], 'unique']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'password' => 'Password',
            'status' => 'Status',
            'contact_name' => 'Contact Name',
            'mobile' => 'Mobile',
            'phone' => 'Phone',
            'fax' => 'Fax',
            'qq' => 'Qq',
            'email' => 'Email',
            'is_root' => 'Is Root',
            'user_type' => 'User Type',
            'adnetwork_slot' => 'Adnetwork Slot',
            'traffic_slot' => 'Traffic Slot',
            'media_slot' => 'Media Slot',
            'registed_at' => 'Registed At',
            'registed_ip' => 'Registed Ip',
            'lastlogin_at' => 'Lastlogin At',
            'lastlogin_ip' => 'Lastlogin Ip',
            'login_count' => 'Login Count',
            'creator' => 'Creator',
            'last_update' => 'Last Update',
        ];
    }
}
